package com.server.http.handler.impl;

import com.server.conditionenum.HttpReturnStatus;
import com.server.db.DataBaseManager;
import com.server.http.handler.HttpHandler;
import com.server.http.request.HttpRequestMessage;
import com.server.http.response.HttpResponseMessage;
import com.server.mine.net.HttpProtocol;

/**
* @author	李小布
* @email	397554852@qq.com
* @version	创建时间：2018年9月20日 下午3:32:49
*/
public class DelAccount extends HttpHandler{
	@Override
	public void handle(HttpRequestMessage request, HttpResponseMessage response) {
		int status = 0;
		String failMsg = null;
		
		long uid = 0;
		try {
			uid = Long.parseLong(request.getParameter("uid"));
		}catch (Exception e) {
			uid = -1;
		} 
		if(uid == -1) {
			failMsg = "参数错误或参数值为空!";
		}else {
			DataBaseManager.GetInstance().DeleteAccount(uid);
		}
		
		
		if(status == 1) {

			SetReturnData(response,"删除成功!",HttpProtocol.DELACCOUNT,HttpReturnStatus.Successed);
		}else {

			SetReturnData(response,failMsg,HttpProtocol.DELACCOUNT,HttpReturnStatus.Successed);
		}
	}

}